<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>接收</title>
</head>
<body>

    <?php

//        var_dump(rename("./a","cc"));

        $username=$_GET['username'];
        //var_dump($_FILES);
        $f=$_FILES['file'];
        for($i=0;$i<2;$i++){
            if(is_uploaded_file($f['tmp_name'][$i])){
                
		
		//修改文件名为年月日
		//echo $f['tmp_name'][$i].'通过验证'.'<br/>';
                //$name=date("Ymdhis").'_'.$i.substr($f['name'][$i],strrpos($f['name'][$i],'.'));    //生成新名字
               

		echo $f['name'][$i].'通过验证'.'<br/>';
                $name=$f['name'][$i];    //生成新名字

 
		echo $name;
                if(!is_dir("./tmp/${username}")){
                    mkdir("./tmp/${username}",0777,true);
                }
                if(move_uploaded_file($f['tmp_name'][$i],"./tmp/${username}/".$name)){
                    echo '移动成功'.'<br/>';
                }
                else{
                    echo '移动失败'.'<br/>';

                }

            }
        }
        echo '上传结果：<br/>';
        foreach($f['error'] as $key =>$val){
            echo $key.'=>'.$val;
            switch($val){
                case 0:
                    echo '成功<br/>';
                    break;
		default :
		    echo '失败<br/>';
		    break;
            }

        }

    echo '<br/><a href='."./iframe/iframe.php?username=${username}".'>back</a>';

    //            sleep(10);
        ?>


        </body>
</html>







